package com.data.center.util.ForeignManage;

import java.lang.reflect.Method;

public class ForeignDataItem {
    public String entityName; // 实体类名称
    public String fieldName; // 实体类字段名称
    public String foreignEntityName; // 关联实体类名称
    public String foreignKey; // 关联字段名称


    public Object serviceClass; // 实体类对应的service类
    public Method searchByForeignKeyMethod; // 查询关联数据方法
    public Method deleteByForeignKeyMethod; // 删除关联方法
    public Method mergeByForeignKeyMethod; // 合并关联方法

    public ForeignDataItem(String entityName,
                           String fieldName,
                           String foreignKey,
                           String foreignEntityName,
                           Object serviceClass,
                           Method searchNumByForeignKeyMethod,
                           Method deleteByForeignKeyMethod,
                           Method mergeByForeignKeyMethod
    ) {
        this.entityName = entityName;
        this.fieldName = fieldName;
        this.foreignKey = foreignKey;
        this.foreignEntityName = foreignEntityName;
        this.serviceClass = serviceClass;
        this.searchByForeignKeyMethod = searchNumByForeignKeyMethod;
        this.deleteByForeignKeyMethod = deleteByForeignKeyMethod;
        this.mergeByForeignKeyMethod = mergeByForeignKeyMethod;
    }

    @Override
    public String toString() {
        return "ForeignDataItem{" +
                "entityName='" + entityName + '\'' +
                ", fieldName='" + fieldName + '\'' +
                ", foreignEntityName='" + foreignEntityName + '\'' +
                ", foreignKey='" + foreignKey + '\'' +
                ", serviceObject=" + serviceClass +
                ", searchNumByForeignKeyMethod=" + searchByForeignKeyMethod +
                ", deleteByForeignKeyMethod=" + deleteByForeignKeyMethod +
                ", mergeByForeignKeyMethod=" + mergeByForeignKeyMethod +
                '}';
    }
}